-
Notifications
You must be signed in to change notification settings - Fork 42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for bearer token auth, additional arbitrary HTTP headers #81
Conversation
I tested the provider "kafka-connect" {
url = "https://admin-k8s.xxx/api/v1/namespaces/dev/services/http:cp-kafka-connect:8083/proxy"
+ extra_headers = {
+ "cookie" = "R_PCS=dark; R_REDIRECTED=true; R_LOCALE=en-us;...."
+ }
} Without the
With the Terraform will perform the following actions:
# kafka-connect_connector.postgresql-outbox will be updated in-place
~ resource "kafka-connect_connector" "postgresql-outbox" {
~ config = {
- "slot.drop.on.stop" = "true" -> null
# (16 unchanged elements hidden)
}
id = "postgresql-outbox"
name = "postgresql-outbox"
# (1 unchanged attribute hidden)
}
# kafka-connect_connector.postgresql-outbox-dev will be updated in-place
~ resource "kafka-connect_connector" "postgresql-outbox-dev" {
~ config = {
+ "connector.class" = "io.debezium.connector.postgresql.PostgresConnector"
.....
}
id = "postgresql-outbox-dev"
name = "postgresql-outbox-dev"
# (1 unchanged attribute hidden)
}
Plan: 0 to add, 2 to change, 0 to destroy. |
@benweint Any chance to finalize this PR ? |
Cool, I'm going to mark this as ready for review given that you've been able to test it @MrLuje! |
@Mongey would you mind taking a look when you have a moment? |
@benweint Why have special support for setting a bearer token vs just allowing setting of headers? I think we should remove the bearer token, and rename |
The main reason was that it's easier to inject the bearer token (which is just a string) via the FWIW, one could make the same argument about HTTP basic auth: it's ultimately just a header, so why bother having separate 'user' and 'password' env vars and provider configuration settings? I think it's a matter of convenience (having separate settings saves users of the provider from having to concatenate and base64-encode the username + password and put it into an HTTP header). That being said, if you'd still prefer to keep the provider config interface generic, I'm happy to just switch to |
I've merged #92, thanks for the PR |
Going to suggest using a terraform variable, and using provider "kafka_connect"{
headers = {
"Authorization" = "Bearer ${var.kafka_connect_bearer_token}"
}
} |
Awesome, thank you! |
This PR adds support for configuring this provider to use HTTP bearer authentication against the target Kafka Connect REST API endpoint, as an alternative to HTTP basic auth.
I believe this would address #41 and #33.
I've marked as draft because I've not actually tried this against a real cluster with bearer auth configured yet.